home *** CD-ROM | disk | FTP | other *** search
- /* Empty the InetUtils SMTPd queue directory
- * Useful with for example MLink, which can't run SMTPd itself.
- * Adapted from Mike Meyer's mailq.rexx by Osma Ahvenlampi.
- */
-
- /* Make sure we have the libraries */
- if ~show('Libraries', 'rexxarplib.library') then
- if ~addlib('rexxarplib.library', 0, -30) then do
- say "No rexxarplib, so we can't scan the spool!"
- exit
- end
- if ~show('Libraries', 'rexxsupport.library') then
- if ~addlib('rexxsupport.library', 0, -30) then do
- say "No rexxsupport library, so we can't scan the spool!"
- exit
- end
-
- /* Get the SMTPSPoolDir */
- spooldir = 'mail:spool' /*getuuenv('SMTPSPOOLDIR')*/
- if spooldir = "" then do
- say "Can't find the name of the directory to scan."
- exit
- end
- old = pragma('Directory', spooldir)
-
- /* Get a list of files in it */
- count = filelist('X.#?', files)
-
- /* Now, process them */
- if count = 0 then
- say "No files in the mail queue"
- else do
- do i = 1 to count
- parse value files.i with 'X.'queue
- destination = getdestination(files.i)
- if destination = "" then iterate
- address command 'SMTPpost -n -t' destination 'D.'queue
- if rc=0 then do
- call delete(files.i)
- call delete('D.'queue)
- end
- end
- exit
-
- getdestination: procedure
- parse arg file
-
- if ~open(in, file, 'Read') then return ""
- call readln(in)
- call readln(in)
- addr = readln(in)
- call close in
- return addr